<?php

/**
 * Tramite form base class.
 *
 * @method Tramite getObject() Returns the current form's model object
 *
 * @package    sysdoc-v.1
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseTramiteForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_documento_enviado' => new sfWidgetFormInputHidden(),
      'id_usuario'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Usuario'), 'add_empty' => false)),
      'id_gestion'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Gestion'), 'add_empty' => false)),
      'unidad_origen'        => new sfWidgetFormTextarea(),
      'codigo_documento'     => new sfWidgetFormTextarea(),
      'asunto'               => new sfWidgetFormTextarea(),
      'fecha_tramite'        => new sfWidgetFormDate(),
      'estado_documento'     => new sfWidgetFormInputCheckbox(),
      'total_rutas'          => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id_documento_enviado' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id_documento_enviado')), 'empty_value' => $this->getObject()->get('id_documento_enviado'), 'required' => false)),
      'id_usuario'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Usuario'))),
      'id_gestion'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Gestion'))),
      'unidad_origen'        => new sfValidatorString(),
      'codigo_documento'     => new sfValidatorString(),
      'asunto'               => new sfValidatorString(),
      'fecha_tramite'        => new sfValidatorDate(),
      'estado_documento'     => new sfValidatorBoolean(),
      'total_rutas'          => new sfValidatorInteger(),
    ));

    $this->widgetSchema->setNameFormat('tramite[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Tramite';
  }

}
